<template>
	<view>
		<u-navbar :title="$t('设置')" background="{ background: '#fff' }" title-color="#000"
			back-icon-color="#000"></u-navbar>
		<view class="box">

			<!-- #ifdef APP-PLUS -->
			<view class="list" @click="$.to('/pagesB/pages/my/accountSettings')">
				<view class="view-text">{{ $t("账号设置") }}</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<!-- #endif -->

			<!-- 	<view class="list" @click="$.to('/pages/my/news')">
				<view>消息</view>
				<u-icon name="arrow-right"></u-icon>
			</view> -->
			<view class="list" @click="$.to('/pagesB/pages/my/about')">
				<view class="view-text">{{ $t("关于我们") }}</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<view class="list" @click="handleLangAlert">
				<view class="view-text">{{ $t("语言修改") }}</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<!-- <view class="list">
				<view>日志上传</view>
				<u-icon name="arrow-right"></u-icon>
			</view> -->
			<view class="list" @click="$.to('/pagesB/pages/my/news')">
				<view class="view-text">{{ $t("消息通知") }}</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<view class="btn" @click="logOut">
				{{ $t('退出登录') }}
			</view>
		</view>
		
		<u-popup v-model="sdkshow" mode="center" border-radius="16">
		  <view class="cdkbox">
		    <view class="tit">礼包码</view>
		    <u-input
		      v-model="sdk"
		      input-align="center"
		      :border="true"
		      placeholder="请输入礼包码"
		    />
		    <button @click="duihuan">确定</button>
		  </view>
		</u-popup>
		<u-popup v-model="langShow" :round="10" mode="bottom">
			<view class="mianStyle" @click="switchLanguage('zh')">
				简体中文
			</view>
			<view class="passwordStyles" @click="switchLanguage('en')">
				English
			</view>
			<view class="passwordStyle" @click="handleLangAlert">
				取消
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				langShow: false,
			}
		},
		methods: {
			// 退出登录
			logOut() {
				uni.removeStorageSync('user');
				uni.removeStorageSync('user_token');
				uni.$emit('updataUser')
				uni.navigateTo({
					url: '/pagesB/pages/my/login'
				})
			},
			// 语言 设置
			handleLangAlert() {
				this.langShow = !this.langShow
			},
			// 语言切换
			switchLanguage(locale) {
				uni.setStorageSync('locale', locale)
				this.$i18n.locale = locale;
				this.langShow = false
				setTimeout(() => {
					uni.showToast({
						title: `切换成功`,
						icon: "success",
						duration: 500
					});
				}, 500)
			},


		}
	}
</script>

<style>
	page {
		background: #f2fafc url("https://v4mh6868.oss-cn-beijing.aliyuncs.com/uploads/20240905/ef044002e484978c199820dd1427182b.jpg") no-repeat top center;
		background-size: 100% auto;
	}

	.box {
		padding: 0 30rpx;
		box-sizing: border-box;
	}

	.list {
		background-color: #fff;
		margin: 20rpx auto;
		padding: 34rpx 20rpx;
		box-sizing: border-box;
		border-radius: 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;

	}

	.list .view-text {
		color: #333;
	}

	.list .text {
		color: #fff;
		font-size: 26rpx;
	}

	.btn {
		color: #fff;
		margin: 20rpx auto;
		padding: 30rpx 20rpx;
		box-sizing: border-box;
		border-radius: 10rpx;
		text-align: center;
		font-size: 32rpx;
		background-image: linear-gradient(to right, #c8e6ff, #a7a7f8, #8970f0);
	}

	.mianStyle {
		width: 100%;
		height: 97rpx;
		line-height: 97rpx;
		text-align: center;
		border-bottom: 1rpx solid #e1e1e1;
		border-top: 1rpx solid #e1e1e1;
		background-color:  #fff;
		color: #333;
	}

	.passwordStyle {
		width: 100%;
		height: 97rpx;
		line-height: 97rpx;
		text-align: center;
		background-color:  #fff;
		color: #333;
	}

	.passwordStyles {
		width: 100%;
		height: 97rpx;
		line-height: 97rpx;
		text-align: center;
		border-bottom: 1rpx solid #e1e1e1;
		background-color:  #fff;
		color: #333;
	}
</style>